<template>
  <div class="credential-container">
    <EmptyIndex :isEmpty="vantListGather.list.length">
      <template #listCon>
        <van-list
          v-model="vantListGather.loading"
          :finished="vantListGather.finished"
          :finished-text="vantListGather.finishedText"
          :offset="vantListGather.offset"
          @load="onLoad"
        >
          <ul class="gs-details">
            <li
              v-for="(item, index) in vantListGather.list"
              :key="index"
              @click.prevent="handleCredential(index)"
            >
              <div class="left-info">
                <div class="left-info-t">
                  <div class="order-number">{{ index + 1 }}</div>
                  <div class="left-info-t-gs">
                    <h3>{{ item.certificateName }}</h3>
                    <p>
                      <span>证书编号：{{ item.certNo | isEmptyData }}</span>
                    </p>
                  </div>
                </div>
                <div class="left-info-b">
                  <p>发证日期：{{ item.startDate | dateFormat }}</p>
                  <p>截止日期：{{ item.endDate | dateFormat }}</p>
                </div>
              </div>
              <div class="right-icon">
                <em class="iconfont icon-youjiantou" />
              </div>
            </li>
          </ul>
        </van-list>
      </template>
    </EmptyIndex>
  </div>
</template>

<script>
import EmptyIndex from "@/components/empty";
import { jumpPage } from "@/utils";
import onLoadMixin from "@/mixin/onLoadMixin";
export default {
  name: "Credential",
  components: {
    EmptyIndex,
  },
  mixins: [onLoadMixin],
  data() {
    return {
      pageNum: 1, //页码
    };
  },
  methods: {
    /**
     * 进入资质证书页面
     * @param {*} index 下标
     */
    handleCredential(index) {
      jumpPage(this, "CredentialDetails", {
        companyName: this.$route.query.companyName,
        pageNum: this.pageNum,
        index,
      });
    },
  },
};
</script>